#ifndef LIVEMASTERWIDGET_H
#define LIVEMASTERWIDGET_H

#include <QWidget>
#include <QDebug>
#include <QCamera>
#include <QCameraInfo>
#include <QLabel>

class MainWidget;
class TcpSession;
class CaptureThread;
class MyCameraABS;

namespace Ui {
class LiveMasterWidget;
}

class LiveMasterWidget : public QWidget
{
    Q_OBJECT

public:
    explicit LiveMasterWidget(TcpSession* session,MainWidget* mainWidget, QWidget *parent = nullptr);

    void show(QString & username, QString & nickname, QString& housename, int & houseID);


private slots:
    void onPixCaptured(QPixmap pix);

    void on_pushButton_stop_clicked();
    void on_pushButton_start_clicked();
    void on_pushButton_exit_clicked();
    void on_logout_call_signal(const QString& msg);
    void on_pushButton_camera_close_clicked();
    void on_pushButton_camera_open_clicked();

    void on_houseMems_signal(const QStringList& fields);
    void on_houseMsg_signal(const QString & msg="");
//    void on_gift_sinal(const QString & nickname, const QString & gift);
//    void on_bullet_signal(const QString & nickname, const QString & msg);
    void on_camera_signal(QPixmap& pic);

private:
    Ui::LiveMasterWidget *ui;
    MainWidget* mainWidget=nullptr;

    QString username;
    QString nickname;
    QString housename;
    int houseID;

    TcpSession* session=nullptr;
    //直播: 界面捕捉线程
    CaptureThread* thread=nullptr;
    int picid=0;
    //摄像头
    MyCameraABS* myCameraABS;
    QCamera* camera;

};

#endif // LIVEMASTERWIDGET_H
